﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.BreedingInfoCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.BreedingInfoCommandHandler
{
    public class DelRangeBreedingInfoCommandHandler : IRequestHandler<DelRangeBreedingInfoCommand, Results<int>>
    {


        private readonly IBreedingInfoService _service;
        public DelRangeBreedingInfoCommandHandler(IBreedingInfoService service)
        {
            _service = service;
        }
        public async Task<Results<int>> Handle(DelRangeBreedingInfoCommand request, CancellationToken cancellationToken)
        {
            var list = await _service.DeleteRangeBreedingInfo(request.BreedIds);
            return Results<int>.DataResult(list);
        }
    }
}
